package com.wuyou.sso.common.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.wuyou.sso.common.annotation.DictValue;
import com.wuyou.sso.common.annotation.Label;
import com.wuyou.sso.common.annotation.MapDict;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 租户类型枚举
 *
 * @author zhengzhouyi
 * @date 2022-9-15 09:47:06
 */
@RequiredArgsConstructor
@MapDict(code = "tenant-type",name = "租户类型")
public enum TenantTypeEnum implements IEnum<Integer> {

    /**
     *仓库
     */
    @Label("仓库")
    WAREHOUSE(10, "仓库"),
    /**
     * 货代
     */
    @Label("货代")
    FORWARDER(20, "货代");

    /**
     * 类型
     */
    @DictValue
    private final Integer type;

    /**
     * 描述
     */
    @JsonValue
    @Getter
    private final String description;

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static TenantTypeEnum getEnum(Object value) {
        return EnumUtil.likeValueOf(TenantTypeEnum.class, value);
    }

    @Override
    public Integer getValue() {
        return this.type;
    }
}
